package com.xiaouyudeguang.common.entity;

import com.alibaba.excel.annotation.ExcelProperty;
import com.xiaouyudeguang.common.runner.CodeRunner;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.HashMap;
import java.util.Map;

@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class CodeBody {

    @ExcelProperty("组织")
    private String group;

    @ExcelProperty("模块")
    private String module;

    @ExcelProperty("基础包名")
    private String basePackage;

    @ExcelProperty("表名")
    private String tableName;

    @ExcelProperty("表注释")
    private String comment;

    @ExcelProperty("表字段")
    private String column;

    private boolean toPinyin;

    private Map<String, String> columns = new HashMap<>();

    public boolean execute() throws Exception {
        return CodeRunner.builder().group(group).basePackage(basePackage).toPinyin(toPinyin).module(module).tableName(tableName).comment(comment).columns(columns).build().execute();
    }
}
